1. Technical Field
The present invention is directed to resource allocations in a computer system. More specifically, the present invention is directed to a system, apparatus and method of enhancing priority boosting of a scheduled thread.
2. Description of Related Art
At any given processing time, there may be a multiplicity of processes or threads waiting to be executed on a processor or CPU of a computing system. To best utilize the CPU of the system then, it is necessary that an efficient mechanism that properly queues the processes or threads for execution be used. The mechanism used by most computer systems to accomplish this task is a scheduler.
Note that a process is a program. When a program is executing, it is loosely referred to as a task. In most operating systems, there is a one-to-one relationship between a task and a program. However, some operating systems allow a program to be divided into multiple tasks or threads. Such systems are called multithreaded operating systems. For the purpose of simplicity, threads and processes will henceforth be used interchangeably.
A scheduler is a software program that coordinates the use of a computer system's shared resources (e.g., a CPU). The scheduler usually uses an algorithm such as a first-in, first-out (i.e., FIFO), round robin or last-in, first-out (LIFO), a priority queue, a tree etc. algorithm or a combination thereof in doing so. Basically, if a computer system has three CPUs (CPU1, CPU2 and CPU3), each CPU will accordingly have a ready-to-be-processed queue or run queue. If the algorithm in use to assign processes to the run queue is the round robin algorithm and if the last process created was assigned to the queue associated with CPU2, then the next process created will be assigned to the queue of CPU3. The next created process will then be assigned to the queue associated with CPU1 and so on. Thus, schedulers are designed to give each process a fair share of a computer system's resources.
Sometimes a system administrator may want different processes to receive a different share of the CPU time, for example. In that case, a workload manager (WLM) is used in conjunction with the scheduler. The WLM assigns a priority number to each process. Each time a process consumes some CPU time, its priority number is reduced. This scheme allows processes that have a lower priority number to nonetheless receive some CPU time.
When a process is being processed by a CPU and for some reason needs to wait for an event to occur before proceeding, for efficiency reasons, the process may cede the rest of its turn at the CPU to another process and goes to sleep. If the process has a lock on a shared kernel resource, it will not relinquish the lock before it goes to sleep. For example, when a first process is using a shared kernel resource such as a buffer, it will put a lock on the buffer to prevent all other processes from using the buffer. If the first process was performing some disk input/output (I/O), it may allow another process to use the CPU and go to sleep while the disk I/O is completing. Once the disk I/O has completed, the first process may awaken. If a second process with a higher priority number needs to use the buffer in the mean time, it will have to wait until the first process obtains some CPU time to complete its task and release the lock on the buffer.
To reduce the amount of time the second process may have to wait, priority boosting has been used. Priority boosting occurs when a second process with a higher priority number passes its priority number to a first process with a lower priority number and which has a lock on a needed shared resource to increase the first process' likelihood at being the next process chosen to receive some CPU time. As will be explained later, although it now has a higher priority number, the first process may not obtain the CPU right away if another process is currently using the CPU.
Thus, what is needed is a system and method of enhancing priority boosting such that a process that has a lock on a shared resource and whose priority has been boosted may obtain some CPU time as soon as possible.